package com.jc.service.systemloglist;

import java.util.Date;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jc.cds.model.CustomSystemLogList;
import com.jc.ds.base.service.BaseServiceImpl;
import com.jc.ds.mapper.BaseCustomMapper;
import com.jc.ds.model.SystemLogList;
import com.jc.framework.enums.Conclusion;
import com.jc.framework.enums.LogType;

@Service
public class SystemLogListServiceImpl extends BaseServiceImpl<SystemLogList, CustomSystemLogList, Long> implements SystemLogListService {

	@Override
	public BaseCustomMapper<CustomSystemLogList, Long> getCustomMapper() {
		return null;
	}

	
	@Transactional
	public void addSystemLog(String businessData,Conclusion conclusion,String exceptionMsg,LogType type,String respText) {
		SystemLogList log = new SystemLogList();
		log.setCreateTime(new Date());
		log.setBusinessData(businessData);
		log.setConclusion(conclusion.getName());
		if(StringUtils.isNotBlank(exceptionMsg))log.setExceptionMsg(exceptionMsg);
		log.setLogType(type.getName());
		log.setLogTypeName(type.getDesc());
		if(StringUtils.isNotBlank(respText))log.setRespText(respText);
		add(log, false);
	}
	

}
